﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DungeonAndDragonApplication.Controller.Game.UserInformation;
using ADNDNetwork.Network.Client;
using ADNDNetwork;

namespace DungeonAndDragonApplication.Controller.Commands
{
    public class SendMessage : ICommand
    {
        private string message;
        private AdndMessage _message;
        private UserConnectionInformation userConnectionInformation;

        public SendMessage(string message)
        {
            this.message = message;
        }

        public SendMessage(AdndMessage message)
        {
            _message = message;
        }

        public bool execute()
        {   
            /*
            // TODO: Send message to server......
            lock (ClientManager.getInstance())
            {
                ClientManager.getInstance().SendMessageToClient(1, message);
            }*/

            return true;
        }

        #region PROPERTIES
        
        public string Message
        {
            get { return message; }
            set { message = value; }
        }
        public UserConnectionInformation UserConnectionInformation
        {
            get { return userConnectionInformation; }
            set { userConnectionInformation = value; }
        }

        #endregion

        public void execute(AdndMessage message)
        {
            lock (ClientManager.GetInstance())
            {
                ClientManager.GetInstance().SendMessageToServer(message);
            }
        }
    }
}
